package cn.hfjava.kz;

import cn.dev33.satoken.SaManager;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.transaction.annotation.EnableTransactionManagement;
//引入spring-boot-starter-security的jar包后,会自动生成一套登录表单,启动的时候控制台会输出password,账号默认是user，
// 在不用这套权限框架的情况下,可以在启动类中加入以下注解,关掉权限验证

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@MapperScan(basePackages = "cn.hfjava.kz.mapper")
@EnableTransactionManagement
@Slf4j
public class KzApplication {

    public static void main(String[] args) {

        SpringApplication.run(KzApplication.class, args);
        log.info("项目已启动");
        log.info("Sa-Token 配置如下：{}", SaManager.getConfig());
    }


    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

}
